function myFunction() {

	var grade = document.getElementById("grade"); //获取分数

	//判断是否为数字
	if (!isNaN(grade.value) && grade.value <= 100 && grade.value >= 0 && grade.value != "") {

		var result; //保存结果
		var g = parseInt((grade.value / 10)); //获取等级

    //判断学生等级
		switch (g) {
			case 0:
				result = "你成绩的等级为：10等生。";
				break;
			case 1:
				result = "你成绩的等级为：9等生。";
				break;
			case 2:
				result = "你成绩的等级为：8等生。";
				break;
			case 3:
				result = "你成绩的等级为：7等生。";
				break;
			case 4:
				result = "你成绩的等级为：6等生。";
				break;
			case 5:
				result = "你成绩的等级为：5等生。";
				break;
			case 6:
				result = "你成绩的等级为：4等生。";
				break;
			case 7:
				result = "你成绩的等级为：3等生。";
				break;
			case 8:
				result = "你成绩的等级为：2等生。";
				break;
			case 9:
				result = "你成绩的等级为：1等生。";
				break;
			case 10:
				result = "您满分了等级为：特等生。";
				break;
		}

	} else {
		alert("请输入正确的分数！");
		result = "请输入正确的成绩查询等级！";
		grade.focus(); //获取焦点
		grade.value = ""; //清空原值
	}

	//显示结果
	document.getElementById("result").innerHTML = result;
}